import Vue from 'vue';
import Router from 'vue-router';
import CampusBinhai from '@/components/CampusBinhai.vue';
import CampusChashan from '@/components/CampusChashan.vue';
import CampusYueqing from '@/components/CampusYueqing.vue';
import UserLogin from '@/components/UserLogin.vue';
import StudentSystem from '@/components/StudentSystem.vue';

Vue.use(Router);

const routes = [
  {
    path: '/',
    name: 'CampusBinhai',
    component: CampusBinhai
  },
  {
    path: '/campus-chashan',
    name: 'CampusChashan',
    component: CampusChashan
  },
  {
    path: '/campus-yueqing',
    name: 'CampusYueqing',
    component: CampusYueqing
  },
  {
    path: '/login',
    name: 'UserLogin',
    component: UserLogin
  },
  {
    path: '/student-system',
    name: 'StudentSystem',
    component: StudentSystem,
    beforeEnter: (to, from, next) => {
      const isAuthenticated = false; // 假设用户未登录
      if (!isAuthenticated) {
        next('/login');
      } else {
        next();
      }
    }
  }
];

const router = new Router({
  routes
});

export default router;
